#include "framework.h"



								
#define USER_CONFIG()											P00_Input_Mode();P12_PushPull_Mode()

#define EVENT_KEY_TEST_SHORT_PRESS									0x0001
#define EVENT_KEY_TEST_LONG_PRESS										0x0002



void key_scan()
{
	KEY_SCAN_SHORT_LONG(P00,KEY_SHORT_TIME,EVENT_KEY_TEST_SHORT_PRESS,KEY_LONG_TIME,EVENT_KEY_TEST_LONG_PRESS);
}

void on_key_test_short_press()
{
	P12 = 0;
}

void on_key_test_long_press()
{
	P12 = 1;
}

void main(void)
{
	USER_CONFIG();
	timer0_init(TIMER_LOAD_VALUE16(0.001,FOSC,12), key_scan);
	INTERRUPT_ENABLE();
	timer0_start();
	
	event_manual_register(EVENT_KEY_TEST_SHORT_PRESS, on_key_test_short_press);
	event_manual_register(EVENT_KEY_TEST_LONG_PRESS, on_key_test_long_press);

	for(;;)
	{
		event_pull();
	}
}


